package main

import "fmt"

type Stack struct {
	items []int
}

func (s *Stack) push(item int) {
	s.items = append(s.items, item)
}

func (s *Stack) pop() int {
	if len(s.items) == 0 {
		return -1
	}

	lastIndex := len(s.items) - 1

	poped := s.items[lastIndex]
	s.items = s.items[:lastIndex]
	return poped
}

func main() {

	var s = Stack{}
	s.push(1)
	s.push(2)
	s.push(3)
	s.push(4)

	fmt.Println(s.items)
	fmt.Println(s.pop())
	fmt.Println(s.items)
}
